home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / term / ncomm30.lha / NComm / Host / Host.script < prev    next >
Text File  |  1993-05-31  |  46KB  |  1,363 lines

  1. ;*******************************************************
  2. ; NComm HOST SYSTEM
  3. ; Version see below
  4. ;
  5. ; Copyright © 1989 Daniel Bloch ( ->Ver 1.3)
  6. ; Copyright © 1990-1992 Nils-Arne Dahlberg
  7. ;                FREEWARE!!!!
  8. ;*******************************************************
  9. ; revision history
  10. ; by 1.6 these things are added:
  11. ;       Search for menus, bulletins and messages in separate directories
  12. ;       Private messages for all users
  13. ;    1.7
  14. ;       Private user passwords
  15. ;    1.8
  16. ;       Double menus
  17. ;    1.9
  18. ;       More messages areas
  19. ;    1.91
  20. ;       Packing and download of messages
  21. ;    1.92
  22. ;       UL/DL check
  23. ;    1.93
  24. ;       Remote Backup
  25. ;       Cosysop enabeld
  26. ;    1.94
  27. ;       Using extended hayes setup (all reset z0 gives right setup)
  28. ;    1.95
  29. ;       Removed part of page routine..
  30. ;    1.96
  31. ;       Changes in file menu
  32. ;    1.97
  33. ;       Changes in messages menus
  34. ;       Local mode
  35. ;    1.98
  36. ;       Cleanup, changing sysop/cosysop versions
  37. ;    1.99
  38. ;       Change of dos-commands in SYsop menu
  39. ;       change of sysop password placement
  40. ;    2.00
  41. ;       Changed placement of U/D load credits
  42. ;    2.01
  43. ;       Fixed a bug in placement of $name"DL" files
  44. ;       Added Possibility to grab bulletins
  45. ;       Added "waiting " at up/download
  46. ;    2.02
  47. ;       Changed packing program to variable, use what you want as sysop
  48. ;       'Return' leaves password change.
  49. ;    2.03
  50. ;       Just a bugfix
  51. ;    2.04
  52. ;       Changed timout command to make a 300 s timeout for logon as well
  53. ;    2.05
  54. ;       Made a small change to shorten the file
  55. ;    2.06
  56. ;       Added features: filetransfer with Ymodem-Batch and Ymodem-G
  57. ;       Print version number from main menu
  58. ;    2.07
  59. ;       A special reboot, or break facility included, I might take this
  60. ;       into an later E-script
  61. ;    2.08
  62. ;       Changed for an error when HOLD-directory is missing, this
  63. ;       directory might be missing due to the fact that BU-progs not
  64. ;       allways copies empty directories
  65. ;   2.09
  66. ;       Changed password routine to not accept nil password
  67. ;   2.10
  68. ;       YABH (Yet Another Bug-Hunt...)
  69. ;       Missed two \" in delete comment part...
  70. ;       Added Start Script in Sysop mode....
  71. ;       removed a IF $ -line, line no 680 somewhere....
  72. ;   2.10E
  73. ;       Back in english, again...
  74. ;   2.11E
  75. ;       Some small special features
  76. ;       A user questionare is added, upload for just some users,
  77. ;       a bug in login-sequense is corrected.
  78. ;       The messages editing is made in ram: now
  79. ;
  80. ;   2.12
  81. ;       A few minor modifications: Should now work with DTR-hangup function.
  82. ;       ... and you probably don't have to turn your modem off when you want
  83. ;       to log on locally, the script now sends AT Q1E0 before local logons.
  84. ;       (Changed by Torkel Lodberg [?])
  85. ;
  86. ;   2.20
  87. ;       A version made especially for NComm 2.0
  88. ;       Main differences is a better way to handle the user-info
  89. ;   2.21
  90. ;       Minor bug in login section fixed
  91. ;   2.3
  92. ;    Several bug fixes. Demonstrates ANSI in login sequence. Waits for
  93. ;    two seconds after displaying "messages waiting".
  94.  
  95. SET     $version= "2.3Enad, 930531"
  96.  
  97. ;--------------------------------------------
  98. ; Set these variables to fit your needs
  99. ;--------------------------------------------
  100.         SET     $dir    = "ncomm:host/"            ;Directory for misc. files
  101.                                                 ;base of all other
  102.         SET     $menudir = $dir"menus/"         ;menus here
  103.         SET     $bulldir = $dir"bulletins/"     ;bulletins here
  104.         SET     $msgsdir = $dir"msgs/"          ;messages here
  105.         SET     $uldir  = $dir"files/"          ;Upload directory
  106.         SET     $dldir  = $dir"files/"          ;Download directory
  107.         SET     $hold   = $dir"hold/"        ;Hold directory
  108.         SET     $apack   = "c:lha a "        ;packing command
  109.         SET     $alist   = "c:lha l "        ;listing command
  110.         SET     $aextract ="c:lha x "        ;extract command
  111.         SET     $arch    = ".lzh"               ;archive extension
  112.         SET     $holdzoo = $dir"files/HOLD"$arch        ;Hold file
  113.         SET     $tmp    = $dir"files/NHS.tmp"   ;Temporary file
  114.         SET     $sysname = "Boringtown BBS"        ;Name of system
  115.         SET     $list   = "c:list"              ;Directory lister
  116.         SET     $qlist  = "c:dir"               ;A quick lister
  117.     SET    $delete = "c:delete"            ;Delete
  118.     SET    $copy = "c:copy"                ;Copy
  119.         SET     $MaxBaud = "2400"               ;Modems Maximum Baud
  120.         SET     $doscomm = $dir"Ckomm/"         ;dos commands for remote
  121.  
  122. ;All files in hold directory will be deleted at initialization!!!
  123.  
  124. ;-------------------- M A I N   P R O G R A M -----------------------;
  125.         message "\f"            ;Clear screen
  126.         REQUEST OFF
  127. main:   clrstack
  128.         gosub   init            ;Initialize various stuff
  129.         gosub   connect         ;Wait for RING and answer the phone
  130.         timeout 300 goto bibi   ;must have it here i think..
  131.         when    "\r\nNO CARRIER\r\n" goto NoCarrier
  132.         gosub   prelog          ;Show opening picture
  133. ;LOGIN gives a returnvariable: $NameOK set to "T" if the name exists
  134. ;and $PassOK is set to true if name and password is OK
  135.         gosub   login           ;Get name & password
  136.         timeout 300 goto bibi   ;must have it here i think..
  137.         if      $PassOK == "T" then goto OK
  138. WrngName:
  139.         send    "Wrong!!\n"
  140.         write   $dir"log" "\n"$date"  "$name"  Wrong password: "$pass"\n"
  141.         gosub   logout
  142.         goto    main
  143.  
  144. ;User has logged in
  145. OK:     write   $dir"log" "\n"$date"  Login: "$name" ("$baud")\n"
  146.         send    "\n\nYour last logout was:"$inLast"\n"
  147.         set     $ULCredit = $inulcredit
  148.         set     $DLCredit = $indlcredit
  149.         set     $Status = $instatus
  150.         if      $insysop == "Sysop" then SET $sysacc = "T"
  151.         if      $insysop == "CoSys" then SET $sysacc = "T"
  152.         if      $insysop == "CoSys" then SET $cosys = "T"
  153. ; Set right charset
  154.         set     $charset = $incharset
  155. ; Set right protocol
  156.         set     $proto = $inproto
  157.         gosub   SetProto
  158.         gosub   postlog
  159.         timeout 2
  160.         echo    off
  161.         send    "^[[97x"
  162.         input   $id "\r"
  163.         timeout 300 goto bibi   ;must have it here i think..
  164.         echo    on
  165.         send    "\nPress [ENTER] to continue..."
  166.         input   $dummy "\r"
  167.         send    "\f"
  168.         IF      !EXISTS $msgsdir$name then goto OK1
  169.         Send    "\n\nYou have messages waiting.\n"
  170.         send    "==========================\n\n"
  171.         delay   2
  172. OK1:    ascsend $menudir".menu0"
  173.  
  174. ;This is the main loop
  175. loop:   gosub   MainMenu
  176.         send    "Are you sure you want to log off (Enter=Y)? "
  177.         input   $cmd "\r"
  178.         IF $cmd == "N" THEN goto loop
  179.         send    "\n"
  180.         gosub   logout
  181.         goto    main
  182.  
  183.  
  184.  
  185.  
  186. ;--------------------- S U B R O U T I N E S ----------------------
  187.  
  188.  
  189. ;********************************************************
  190. ;* Initialize the system
  191. ;********************************************************
  192. init:   config  $dir"host.config"
  193.         hangup
  194.         send "\w\w\w+++\w\w\w\wATZ\n" ;Reset to saved default
  195.         converse "OK" "\w\w\w+++\w\w\w\wATX4V1M0E1\n" ;
  196.         converse "OK" "\w\w\wATS7=60\n" ;Wait one full minute for carrier
  197.         wait    "OK"
  198.         SET     $sysacc = "F"
  199.         SET     $cosys = "F"
  200.         echo    off
  201.         dwhens
  202.         timeout 0
  203.         CLI     "delete >nil: "$hold"#?"
  204.         write   $hold$sysname $sysname"\n Is running on version "$version"\n"
  205.         return
  206.  
  207.  
  208. ;********************************************************
  209. ;* Wait for CONNECT
  210. ;********************************************************
  211. connect:
  212.         dwhens
  213.         send    " \r"
  214.         gosub   skip
  215. conn0:  SET     $Local = "F"
  216.         message "\n\n\n"$sysname"   [Press '?' for help]\n"
  217.         message "Waiting on call...\n"
  218. ConnW:  timeout 300 Goto DoExitQ        ; just wait for 5 minutes
  219.         input   $char ""        ;Get one character
  220.         timeout 90 goto noconnect
  221.         IF !$char == "?" THEN goto conn1
  222.         message "\n\nSpace = Local logon\n"
  223.         goto    conn0
  224. conn1:  IF $char == " " THEN goto Local
  225.         IF $char == "R" Then goto Local2
  226. conn2:
  227.         when    "CONNECT 1200" goto conn1200
  228.         when    "CONNECT 2400" goto conn2400
  229.         when    "CONNECT 4800" goto conn4800
  230.         when    "CONNECT 9600" goto conn9600
  231.         dtenths 7
  232.         SET     $baud = $MaxBaud
  233.         send    "\n\w\wAT\w\wA\n"
  234.         timeout 90 goto noconnect
  235.         wait    "NO CARRIER"
  236. NoConnect:
  237.         write   $dir"log" "\n\n"$date"  Login Failed\n\n"
  238.         gosub   init
  239.         goto connect
  240.  
  241. conn3:  dwhens
  242.         timeout 300 goto bibi
  243.         echo    on
  244.         gosub   skip
  245.         return
  246.  
  247. Local:  message "\nStarting local logon..."
  248.         SEND    "\n+++\w\wAT\wQ1\wE0\n"
  249.         SET     $baud = "19200"
  250.         SET     $Local = "T"
  251.         goto    conn3
  252.  
  253. Local2: message "\nStarting local/remote logon.."
  254.         SEND    "\n+++\w\wAT\wQ1\wE0\n"
  255.         SET     $baud = "19200"
  256.         goto    conn3
  257.  
  258. QuitNHS:
  259.         config  "NComm:NComm.config"
  260.         end
  261.  
  262. conn1200:
  263.         SET     $baud = "1200"
  264.         goto    conn3
  265. conn2400:
  266.         SET     $baud = "2400"
  267.         goto    conn3
  268. conn4800:
  269.         SET     $baud = "4800"
  270.         goto    conn3
  271. conn9600:
  272.         SET     $baud = "9600"
  273.         goto    conn3
  274. ;**************************************************************************
  275. ; Check if another program wants NHS to quit.
  276. ; In that case, a file named NHSQUIT shuld be placed in the RAM:C directory
  277. ; you should also let the startup-sequence place DELETE there
  278. ; The place of the file may be changed.
  279. ; The Script tells it is quiting by removing this file
  280. ;***************************************************************************
  281. DoExitQ:
  282.         IF !EXISTS "RAM:C/NHSQUIT" THEN goto ConnW
  283.         Hangup  ; shouldn't be neccesary
  284.         CLI "RAM:C/DELETE RAM:C/NHSQUIT"
  285.         QUIT
  286.         END
  287.  
  288. ;********************************************************
  289. ;* Show "prelog", i.e. the picture to be shown before
  290. ;* login.
  291. ;********************************************************
  292. prelog: send    "\f"$sysname" ("$baud") up on "$date"\n"
  293.         send    $NComm" / NComm Host System (NHS) v"$version"\n"
  294.     send    "\e[33m"
  295.         send    "Copyright (c) 1989 Daniel Bloch (-> ver 1.3)\n"
  296.         send    "Copyright (c) 1990 & 1992 Nils-Arne Dahlberg\n\n"
  297.     send    "\e[31m"
  298.         ascsend $dir"prelog"
  299.         return
  300.  
  301.  
  302. ;********************************************************
  303. ;* Show "postlog", i.e. the picture to be shown after
  304. ;* login.
  305. ;********************************************************
  306. postlog:
  307.         send    "\n\n"
  308.         ascsend $dir"postlog"
  309. ;       CLI     "cookie"
  310.         return
  311.  
  312.  
  313. ;********************************************************
  314. ;* Read user name and password into the variables
  315. ;* $name and $pass.
  316. ;********************************************************
  317. Login:  echo    on
  318.         set     $NameOK = "F"
  319.         if      !EXISTS $dir"userfile" then goto FirstUser
  320.         set     $firstrun = "T"
  321.         timeout 120 goto LogSleep
  322. Loginagain:
  323.         send    "\n\nYour name: "
  324.         input   $name "\r"
  325.         IF      $name == "new" then goto NewUser
  326. NilPass:
  327.         send    "\nYour password: "
  328.         echo    off
  329.         input   $pass "\r"
  330.         echo    on
  331.         IF      $pass == "" then goto NilPass
  332.         timeout 300 goto bibi
  333.         send    "\n"
  334.         set     $SkippPassword = "F"
  335.         gosub   CheckName
  336.         if      $PassOK == "T" then return
  337.         if      !$firstrun == "T" then goto AreYouSure
  338.         set     $firstrun = "F"
  339.         send    "\n\nSorry, name or password is incorrect\n"
  340.         send    "Try again, enter NEW if you havn't logged on before.\n"
  341.         goto     Loginagain
  342. AreYouSure:
  343.         Send    "\nThat was two illegal tries.\n"
  344.         send    "Are you sure you want to log on? (N/y):"
  345.         input   $ok "\r"
  346.         send    "\n"
  347.         if      $ok == "Y" then goto Login
  348.         set     $NameOK = "F"
  349.         return
  350. ; Check if the user exists in the user-file, if it does, read all info
  351.  
  352. CheckName:
  353.         set     $NameOK = "F"
  354.         set     $PassOK = "F"
  355.         varfile $dir"userfile"
  356. repeat
  357.         readvar $x
  358.         if !$x == "#" then goto NotName
  359.         if $x == "EOF" then goto NotName
  360.         readvar $inname
  361.         if !$inname == $name then goto NotrightName
  362.         set     $NameOK = "T"
  363. ;The name DO exist, now we read in the rest of the info....
  364.         readvar $inpass
  365.         if $inpass == "EOF" then goto EOFExit
  366.      if  $SkippPassword == "F" then if !$inpass == $pass then goto EOFExit
  367.         readvar $incharset
  368.         if $incharset == "EOF" then goto EOFExit
  369.         readvar $inulcredit
  370.         if $inulcredit == "EOF" then goto EOFExit
  371.         readvar $indlcredit
  372.         if $indlcredit == "EOF" then goto EOFExit
  373.         readvar $instatus
  374.         if $instatus == "EOF" then goto EOFExit
  375.         readvar $insysop
  376.         if $insysop == "EOF" then goto EOFExit
  377.         readvar $inproto
  378.         if $inproto == "EOF" then goto EOFExit
  379.         readvar $inlast
  380.         if $inlast == "EOF" then goto EOFExit
  381.         set     $PassOK = "T"
  382.         goto    NotName
  383. ;This is where we land in case of a sudden EOF or if the password is wrong
  384. EOFExit:
  385.         set     $x = "EOF"
  386.         write   $dir"log" "\n"$date"  USERFILE CORRUPTED, pleas check!!\n"
  387. NotrightName:
  388.         if      $inname == "EOF" then set $x = $inname
  389. NotName:
  390.         until   $x == "EOF"
  391.         varfile Close
  392.         return
  393. LogSleep:
  394.         send    "\n\nLogon terminated after 2 minutes\n"
  395.         gosub   logout
  396.         goto    main
  397.  
  398. ;This is used for the first user to logon, it makes her/him to sysop
  399. FirstUser:
  400.         set     $issysop = "T"
  401.         ascsend $dir"FirstUser"
  402.         set     $NameOK = "F"
  403.         goto    NewName
  404. NewUser:
  405.         ascsend $dir"newuser"
  406.         set     $issysop = "F"
  407. Newname:
  408.         send    "\n\nYour name: "
  409.         input   $name "\r"
  410.         send    "\nIs '"$name"' Correct? (y/N)"
  411.         input   $ok "\r"
  412.         set     $SkippPassword = "F"
  413.         if      $issysop == "F" then gosub   CheckName
  414.         IF      !$ok == "y" then goto Newname
  415.         IF      $NameOK == "F" then goto NewPassIn
  416.         send    "\nSorry, the name "$name" already exists!\n"
  417.         goto    Newname
  418. NewPassIn:
  419.         send    "\nYour password: "
  420.         echo    off
  421.         input   $pass "\r"
  422.         echo    on
  423.         send    "\nOnce more... : "
  424.         echo    off
  425.         input   $pass1 "\r"
  426.         echo    on
  427.         if      $pass == $pass1 then goto NewPassOK
  428.         send    "\nSorry, line noice, enter password again\n"
  429.         goto    NewPassIn
  430. NewPassOk:
  431.         gosub   GetCharSet
  432.         set     $Incharset = $chars
  433.         gosub   GetTransProto
  434.         set     $inproto = $trans
  435.         if      !EXISTS $dir"userfile" then write $dir"userfile" "#\n"
  436.         write   $dir"userfile"  $Name"\n"
  437.         write   $dir"userfile"  $Pass"\n"
  438.         write   $dir"userfile"  $Chars"\n"
  439.         write   $dir"userfile"  "N\n"
  440.         write   $dir"userfile"  "N\n"
  441.         if      $issysop == "T" then write   $dir"userfile" "10\n"
  442.         if      $issysop == "F" then write   $dir"userfile" "1\n"
  443.         if      $issysop == "T" then write   $dir"userfile" "Sysop\n"
  444.         if      $issysop == "F" then write   $dir"userfile" "New\n"
  445.         write   $dir"userfile"  $Trans"\n"
  446.         write   $dir"userfile"  $date"\n"
  447.         write   $dir"log" $date"\n\n  New User: "$name"\n"
  448.         timeout 300 goto bibi
  449.         send    "\n"
  450. ; Here is a questionare, its simple, but it should work...
  451. ;just add and delete questions as apropriate
  452.         send    "\nBefore you enter the BBS, I would like you to answer\n"
  453.         send    "the following questions:\n"
  454.         send    "\nAddress (2/4): "
  455.         input   $tmp "\r"
  456.         write   $dir"userfile"   $tmp"\n"
  457.         send    "\nAddress (3/4): "
  458.         input   $tmp "\r"
  459.         write   $dir"userfile"   $tmp"\n"
  460.         send    "\nAddress (4/4): "
  461.         input   $tmp "\r"
  462.         write   $dir"userfile"   $tmp"\n"
  463.         send    "\nComputer: "
  464.         input   $tmp "\r"
  465.         write   $dir"userfile"   $tmp"\n"
  466.         send    "\n\nThank you, I hope you enjoy it here!\n\n"
  467.         write   $dir"userfile"  "#\n"
  468.         set     $SkippPassword = "F"
  469.         gosub   CheckName
  470.         return
  471.  
  472. ;********************************************************
  473. ;Skip junk from the modem
  474. ;********************************************************
  475. skip:   timeout 3 goto SkipOK
  476. more:   wait    ""
  477.         goto more
  478. SkipOK: timeout 300 goto bibi
  479.         return
  480.  
  481.  
  482. ;********************************************************
  483. ;* Log out
  484. ;********************************************************
  485. logout: ;CLI     "fortune"
  486.         ascsend $dir"Logout"
  487.         hangup
  488.         write   $dir"log" $date"  Logout: "$name"\n"
  489.         CLI     "delete >nil: "$holdzoo" "$hold"#?"
  490.         write   $hold$sysname $sysname"\n Runs with version "$version"\n"
  491.         if      $NameOK == "T" then gosub PreChangeUser
  492.         if      $nameOK == "T" then set $NewLast = $date
  493.         if      $NameOK == "T" then gosub ChangeUser
  494.         return
  495.  
  496. ;********************************************************
  497. ;* User sleeps
  498. ;********************************************************
  499. bibi:   send    "\n\nGood night!"
  500.         write   $dir"log" $date"  Sleep disconect\n"
  501.         gosub   logout
  502.         goto    main
  503.  
  504. ;********************************************************
  505. ;Main menu
  506. ;********************************************************
  507. MainMenu:
  508.         send    "\nCommand (? or ! for menu): "
  509.         input   $cmd "\r"
  510.         send    "\n"
  511.         IF $cmd == "?" THEN ascsend $menudir".menu0"
  512.         IF $cmd == "!" THEN ascsend $menudir"menu0"
  513.         IF $cmd == "G" THEN return
  514.         IF $cmd == "F" THEN gosub FileMenu
  515.         IF $cmd == "B" THEN gosub BullMenu
  516.         IF $cmd == "O" THEN gosub page
  517.         IF $cmd == "S" THEN gosub sysop
  518.         IF $cmd == "C" THEN gosub Comment
  519.         IF $cmd == "M" THEN gosub Messages
  520.         IF $cmd == "E" THEN gosub LetterMenu
  521.         IF $cmd == "P" THEN gosub ChangePasswd
  522.         IF $cmd == "L" THEN gosub ListUsers
  523.         IF $cmd == "V" THEN send "Version:"$version"\n"
  524.         goto    MainMenu
  525.  
  526.  
  527. ;********************************************************
  528. ;Chat with SYSOP
  529. ;********************************************************
  530. page:   send    "Calling SYSOP...\n"
  531.         send    "(press Ctrl-Z to end the conversation)\n"
  532.         beep
  533.         dtenths 3
  534.         beep
  535.         dtenths 3
  536.         beep
  537.         write   $dir"log" $date"  Paged operator\n"
  538.         when    "^Z" goto EndChat
  539. chat:   input   $dummy  "\r"
  540.         send    "\n"
  541.         goto    chat
  542. EndChat:
  543.         dlwhen
  544.         send    "\n"
  545.         return
  546.  
  547. ;*********************************************
  548. ;Change Password
  549. ;*********************************************
  550. ChangePasswd:
  551.     send   "\n\nWhat do you want to change your password to? (Enter to cancel) "
  552.         echo    off
  553.         input   $psw1 "\r"
  554.         if      $psw1 == "" THEN goto PsQuit
  555.         echo    on
  556.         send    "\nOne time more, thanks "
  557.         echo    off
  558.         input   $psw2 "\r"
  559. PsOut:  echo    on
  560.     IF      !$psw1 == $psw2 THEN goto PsQuit
  561.         set     $pass = $psw2
  562.         gosub   PreChangeUser
  563.     set     $NewPass = $psw2
  564.     gosub   ChangeUser
  565.         return
  566.  
  567. PsQuit: set $psw1 = $pass
  568.     set $psw2 = $pass
  569.         goto PsOut
  570.  
  571.  
  572. ;*******************************************************
  573. ;Set transfer protocoll
  574. ;*******************************************************
  575. SetProto:
  576.         if      $proto == "X" then MENUSELECT TRANSFER 7 0
  577.         if      $proto == "Y" then MENUSELECT TRANSFER 7 1
  578.         if      $proto == "B" then MENUSELECT TRANSFER 7 2
  579.         if      $proto == "G" then MENUSELECT TRANSFER 7 3
  580.         if      $proto == "Z" then MENUSELECT TRANSFER 7 4
  581.         if      $proto == "K" then MENUSELECT TRANSFER 7 5
  582.         if      $proto == "E" then MENUSELECT TRANSFER 7 6
  583.         if      $proto == "J" then MENUSELECT TRANSFER 7 7
  584.         if      $proto == "Q" then MENUSELECT TRANSFER 7 8
  585.         return
  586.  
  587. ;*******************************************************
  588. ;choose characterset
  589. ;*******************************************************
  590. GetCharSet:
  591.         send    "\nWhat character set do you want to use? (L for list):"
  592.         input   $chars "\r"
  593.         send    "\n"
  594.         if      $chars == "L" then ascsend $dir"CharSets"
  595.         if      $chars == "L" then goto GetCharSet
  596.         if      $chars == "" then goto GetCharSet
  597.         varfile $dir"CharSets"
  598.         set     $y = "F"
  599. repeat
  600.         readvar $x
  601.         if      !$chars == $x then goto NextChars
  602.         set     $x = "EOF"
  603.         set     $y = "T"
  604. NextChars:
  605.         until   $x == "EOF"
  606.         varfile close
  607.         if      $y == "T" then goto CharsetOK
  608.         send    "\nI don't support charset "$chars". Please reenter.\n"
  609.         goto    GetCharSet
  610. CharsetOK:
  611.         return
  612.  
  613. ;*******************************************************
  614. ;Get transfer protocoll
  615. ;*******************************************************
  616. GetTransProto:
  617.         send    "\nWhat Transfer protocol do you want to use? (L for list):"
  618.         input   $trans "\r"
  619.         send    "\n"
  620.         if      $trans == "L" then ascsend $dir"TransProtos"
  621.         if      $trans == "L" then goto GetTransProto
  622.         if      $trans == "" then goto GetTransProto
  623. CheckProto:
  624.         varfile $dir"TransProtosS"
  625.         set     $y = "F"
  626. repeat
  627.         readvar $x
  628.         if      !$trans == $x then goto NextTrans
  629.         set     $x = "EOF"
  630.         set     $y = "T"
  631. NextTrans:
  632.         until   $x == "EOF"
  633.         varfile close
  634.         if      $y == "T" then goto TransOK
  635.         send    "\nI don't support protocol "$trans". Please reenter.\n"
  636.         goto GetTransProto
  637. TransOK:
  638.         return
  639.  
  640. ;*******************************************************
  641. ;Prepeare variables for changeuser
  642. ;*******************************************************
  643. PreChangeUser:
  644.         Set     $newpass = $pass
  645.         Set     $newcharset = $charset
  646.         Set     $newULCredit = $ULCredit
  647.         Set     $newDLCredit = $DLCredit
  648.         Set     $newStatus = $Status
  649.         Set     $newSysop = $insysop
  650.         Set     $newProto = $Proto
  651.         Set     $newLast = $inlast
  652.         return
  653.  
  654. ;*******************************************************
  655. ;Change a entry in 'userfile'
  656. ;*******************************************************
  657. ChangeUser:
  658.         set     $CUOK = "F"
  659.         cli     "copy >nil: "$dir"userfile to "$dir"userfile.old"
  660.         cli     "delete >nil: "$dir"userfile"
  661.         varfile $dir"userfile.old"
  662. repeat
  663.         readvar $x
  664.         write   $dir"userfile" $x"\n"
  665.         if !$x == "#" then goto CUNotName
  666.         if $x == "EOF" then goto CUNotName
  667.         readvar $inname
  668.         set $x = $inname
  669.         if $x == "EOF" then goto CUNotName
  670.         write   $dir"userfile" $inname"\n"
  671.         if !$inname == $name then goto CUNotrightName
  672. ;The name DO exist, now we read in the rest of the info....
  673.         readvar $inpass
  674.         write   $dir"userfile" $newpass"\n"
  675.         if $inpass == "EOF" then goto CUEOFExit
  676.         readvar $incharset
  677.         write   $dir"userfile" $newcharset"\n"
  678.         if $incharset == "EOF" then goto CUEOFExit
  679.         readvar $inulcredit
  680.         write   $dir"userfile" $newULCredit"\n"
  681.         if $inulcredit == "EOF" then goto CUEOFExit
  682.         readvar $indlcredit
  683.         write   $dir"userfile" $newDLCredit"\n"
  684.         if $indlcredit == "EOF" then goto CUEOFExit
  685.         readvar $instatus
  686.         write   $dir"userfile" $newStatus"\n"
  687.         if $instatus == "EOF" then goto CUEOFExit
  688.         readvar $insysop
  689.         write   $dir"userfile" $newSysop"\n"
  690.         if $insysop == "EOF" then goto CUEOFExit
  691.         readvar $inproto
  692.         write   $dir"userfile" $newProto"\n"
  693.         if $inproto == "EOF" then goto CUEOFExit
  694.         readvar $inlast
  695.         write   $dir"userfile" $newLast"\n"
  696.         if $inlast == "EOF" then goto EOFExit
  697.         set     $CUOK = "T"
  698.         goto    CUNotName
  699. ;This is where we land in case of a sudden EOF
  700. CUEOFExit:
  701.         set     $x = "EOF"
  702.         write   $dir"log" "\n"$date"  USERFILE CORRUPTED, pleas check!!\n"
  703. CUNotrightName:
  704.         if      $inname == "EOF" then set $x = $inname
  705. CUNotName:
  706.         until   $x == "EOF"
  707.         varfile Close
  708.  
  709.         return
  710.  
  711. ;*******************************************************
  712. ;List users who have logged in
  713. ;*******************************************************
  714. ListUsers:
  715.         send    "\nUsers up to "$date"\n"
  716.         varfile $dir"userfile"
  717. repeat
  718.         readvar $x
  719.         if !$x == "#" then goto LUNotName
  720.         if $x == "EOF" then goto LUNotName
  721.         readvar $x
  722.         if $x == "EOF" then goto LUNotName
  723.         send    "\nName="$x"\n"
  724.         readvar $x
  725.         if $x == "EOF" then goto LUNotName
  726. if $sysacc == "T" then send "Password="$x"\n"
  727.         readvar $x
  728.         if $x == "EOF" then goto LUNotName
  729. if $sysacc == "T" then send "Charset="$x"\n"
  730.         readvar $x
  731.         if $x == "EOF" then goto LUNotName
  732. if $sysacc == "T" then send "ULCredits="$x"\n"
  733.         readvar $x
  734.         if $x == "EOF" then goto LUNotName
  735. if $sysacc == "T" then send "DLCredits="$x"\n"
  736.         readvar $x
  737.         if $x == "EOF" then goto LUNotName
  738.         readvar $x
  739.         if $x == "EOF" then goto LUNotName
  740.         send    "Userlevel="$x"\n"
  741.         readvar $x
  742.         if $x == "EOF" then goto LUNotName
  743. if $sysacc == "T" then send "Protcolls="$x"\n"
  744.         readvar $x
  745.         if $x == "EOF" then goto LUNotName
  746.         send    "Last on="$x"\n"
  747.         readvar $x
  748.         if $x == "EOF" then goto LUNotName
  749.         send    "Address="$x"\n"
  750.         readvar $x
  751.         if $x == "EOF" then goto LUNotName
  752.         send    "Address="$x"\n"
  753.         readvar $x
  754.         if $x == "EOF" then goto LUNotName
  755.         send    "Address="$x"\n"
  756.         readvar $x
  757.         if $x == "EOF" then goto LUNotName
  758.         send    "Computer="$x"\n"
  759. LUNotName:
  760.         until   $x == "EOF"
  761.         varfile Close
  762.  
  763.         return
  764.  
  765. ;********************************************************
  766. ;File menu
  767. ;********************************************************
  768. FileMenu:
  769.         send    "\nFile command (? or ! for menu): "
  770.         input   $cmd "\r"
  771.         send    "\n"
  772.         IF $cmd == "?" THEN ascsend $menudir".menu1"
  773.         IF $cmd == "!" THEN ascsend $menudir"menu1"
  774.         IF $cmd == ""  THEN return
  775.         IF $cmd == "Q" THEN return
  776.         IF $cmd == "L" THEN gosub ListFiles
  777.         IF $cmd == "D" THEN gosub Download
  778.         IF $cmd == "U" THEN gosub Upload
  779.         IF $cmd == "V" THEN gosub ViewZOO
  780.         IF $cmd == "S" THEN gosub QListFiles
  781.         IF $cmd == "EXT" THEN gosub ExtractZOO
  782.         IF $cmd == "ADD" THEN gosub AddFile
  783.         IF $cmd == "DEL" THEN gosub Remove
  784.         IF $cmd == "DIR" THEN gosub Show
  785.         IF $cmd == "GET" THEN gosub GetHold
  786.         goto    FileMenu
  787.  
  788.  
  789. ;********************************************************
  790. ;List files in download directory
  791. ;********************************************************
  792. ListFiles:
  793.         send    "\n"
  794.         CLI     $list" "$dldir
  795.         return
  796.  
  797.  
  798. ;********************************************************
  799. ;List files in download directory quick
  800. ;********************************************************
  801. QListFiles:
  802.         send    "\n"
  803.         CLI     $qlist" "$dldir
  804.         return
  805.  
  806.  
  807. ;********************************************************
  808. ;Download file
  809. ;********************************************************
  810. Download:
  811.         IF $DLCredit == "Y" then goto DownlOK1
  812.         send    "\nNo files up, no files down....\n"
  813.         return
  814. DownlOK1:
  815.         send    "\nFilename: "
  816.         input   $file "\r"
  817.         send    "\n"
  818.         IF $file == "" THEN return
  819.         IF exists $dldir$file THEN goto DownlOK
  820.         send    "The file '"$file"' does not exist!\n"
  821.         return
  822. DownlOK:
  823.         send    "Choose protocol (return for "$proto"):"
  824.         input   $nproto "\r"
  825.         send    "\n"
  826.         IF $nproto == "" THEN goto XDownload
  827.         set     $trans = $nproto
  828.         gosub   CheckProto
  829.         set     $proto = $trans
  830.         gosub   SetProto
  831. XDownload:
  832.         send    "Waiting...\n"
  833.         upload  $dldir$file
  834.         write   $dir"log" $date"  Downloaded "$file" (Xmodem)\n"
  835.         Set     $DLCredit = "N"
  836.         return
  837.  
  838. ;********************************************************
  839. ;Upload file
  840. ;********************************************************
  841. Upload:
  842.         send    "\nFilename: "
  843.         input   $file "\r"
  844.         send    "\n"
  845.         IF $file == "" THEN return
  846.         IF $ULCredit == "Y" then goto ULOK
  847.         send    "\n\nSorry, you have no upload-credit..\n"
  848.         return
  849. ULOK:
  850.         IF !EXISTS $uldir$file THEN goto UploadOK
  851.         send    "The file '"$file"' allready exists!\n"
  852.         return
  853. UploadOK:
  854.         send    "Describe the file: "
  855.         input   $desc "\r"
  856.         send    "\n"
  857. GetProto:
  858.         send    "Choose protocol (return for "$proto"):"
  859.         input   $nproto "\r"
  860.         send    "\n"
  861.         IF $nproto == "" THEN goto XUpload
  862.         set     $trans = $nproto
  863.         gosub   CheckProto
  864.         set     $proto = $trans
  865.         gosub   SetProto
  866. XUpload:
  867.         send    "Waiting...\n"
  868.         download $uldir$file
  869.         write   $dir"log" $date"  Uploaded "$file" (Xmodem)\n"
  870.         IF !$desc == "" THEN CLI "Filenote file "$uldir$file" comment \""$desc"\""
  871.         set     $DLCredit = "Y"
  872.         return
  873.  
  874. ;********************************************************
  875. ;Bulletin menu
  876. ;********************************************************
  877. BullMenu:
  878.         ascsend $menudir".menu2"
  879. bull:   send    "\nBulletin number (? or ! for menu): "
  880.         input   $cmd "\r"
  881.         send    "\n"
  882.         IF $cmd == "?"  THEN goto BullMenu
  883.         IF $cmd == "!"  THEN goto BullMe
  884.         IF $cmd == ""   THEN return
  885.         IF $cmd == "Q"  THEN return
  886.         IF exists $bulldir"bull"$cmd THEN goto ShowBull
  887.         send    "Illegal bulletin-number!\n"
  888.         goto    bull
  889. BullMe:
  890.         ascsend $menudir"menu2"
  891.         goto    bull
  892. ShowBull:
  893.         send    "\n"
  894.         ascsend $bulldir"bull"$cmd
  895.         write   $dir"log" $date"  Read bulletin #"$cmd"\n"
  896.         goto    bull
  897.  
  898.  
  899. ;********************************************************
  900. ;Sysop menu
  901. ;********************************************************
  902. ;rewrite, add possibility for userupdate
  903. SysopMenu:
  904.         ascsend $menudir"menu3"
  905. Sysop:
  906.         IF $sysacc == "T" THEN goto SysOK
  907.         send    "Nope, you're not allowed!\n"
  908.         write   $dir"log" $date"  Attempted restricted command\n"
  909.         return
  910. SysOK:  send    "\nSysop Command (? for menu): "
  911.         input   $cmd "\r"
  912.         send    "\n"
  913.         IF $cmd == "?" THEN goto SysopMenu
  914.         IF $cmd == "Q" THEN return
  915.         IF $cmd == ""  THEN return
  916.         IF $cmd == "L" THEN goto ListLog
  917.         IF $cmd == "R" THEN goto Priv
  918.         IF $cmd == "D" THEN goto DeleteLog
  919.         IF $cmd == "C" THEN goto DeleteComm
  920.         IF $cmd == "B" THEN goto RemoteBackup
  921.         IF $cmd == "S" THEN goto StartScript
  922.         IF $cmd == "U" THEN goto UserUpdate
  923.  
  924. ;********************************************************
  925. ;Execute DOS command
  926. ;********************************************************
  927.         write   $dir"log" $date"  Executed DOS command: "$cmd"\n"
  928.         send    "\n Commands that can be executed from remote are:\n"
  929.         CLI     $list " " $doscomm
  930.         if      $local == "F" then goto NoLocalDos
  931.         CLI     $cmd
  932.         goto sysok
  933. NoLocalDos:
  934.         CLI     $doscomm$cmd
  935.         goto sysok
  936.  
  937. NoDos:
  938.         send    "\n\nOnly available in local mode, sorry!!\n\n"
  939.         goto sysok
  940.         goto    sysok
  941.  
  942.  
  943. ;********************************************************
  944. ;Delete log file
  945. ;********************************************************
  946. DeleteLog:
  947.         if      $local == "F" then goto NoDos
  948.         IF      $cosys == "T" then goto sysok
  949.         send    "\nSure? (Enter=N)? "
  950.         input   $cmd "\r"
  951.         send    "\n"
  952.         IF !$cmd == "Y" THEN goto sysok
  953.         CLI     "delete "$dir"log"
  954.         write   $dir"log" $date"  Started new log\n"
  955.         goto sysok
  956.  
  957.  
  958. ;********************************************************
  959. ;Delete private messages
  960. ;********************************************************
  961. DeleteComm:
  962.         if      $local == "F" then goto NoDos
  963.         IF      $cosys == "T" then goto sysok
  964.         send    "\nDelete all private messages (Enter=N)? "
  965.         input   $cmd "\r"
  966.         send    "\n"
  967.         IF !$cmd == "Y" then goto sysok
  968.         CLI "delete >nil: "$msgsdir"Comments"
  969.         write   $dir"log" $date"  Private messages deleted\n"
  970.         goto sysok
  971.  
  972.  
  973. ;********************************************************
  974. ;List log file
  975. ;********************************************************
  976. ListLog:
  977.         send    "\n"
  978.         ascsend $dir"log"
  979.         write   $dir"log" $date"  Listed Log\n"
  980.         goto sysok
  981.  
  982.  
  983. ;********************************************************
  984. ;Remote Backup
  985. ;********************************************************
  986. RemoteBackup:
  987.         send    "\nRemote Backup started.\n"
  988.         CLI     "run >nil: <nil: copy ncomm:host to df1:host all clone"
  989.         write   $dir"log" $date"  Started Remote Backup\n"
  990.         goto sysok
  991.  
  992. ;********************************************************
  993. ;Start a script
  994. ;********************************************************
  995. StartScript:
  996.         Send    "\n\nThis is a Point of No Return!!!\n\n"
  997.         send    "When the script is started there is _NO WAY BACK_\n\n"
  998.         Send    "Continue? (Enter=N)"
  999.         input   $Cont "\r"
  1000.         If      $cont == "Y" THEN GOTO StartS1
  1001.         goto    sysok
  1002. StartS1:
  1003.         CHAIN   $dir"A.Script"
  1004.  
  1005.  
  1006.  
  1007. ;********************************************************
  1008. ;Uppdate user
  1009. ;********************************************************
  1010. UserUpdate:
  1011.         set     $tmpsysop = $insysop
  1012.         set     $tmplast = $inlast
  1013.         set     $tmpname = $name
  1014.         send    "\nWhat user do you eant to update/change? "
  1015.         input   $name "\r"
  1016.         send    "\n"
  1017.         set     $SkippPassword = "T"
  1018.         gosub   CheckName
  1019.         if      $NameOK == "T" then goto UserUpdateOK
  1020.         send    "\n"$name"Doesn't exist!\n"
  1021.         goto    LeaveUserUpdate
  1022. UserUpdateOK:
  1023. if $insysop == "Sysop" then if !$tmpsysop == "Sysop" then goto LeaveUserUpdate
  1024.         send    "\n"$name" is '"$insysop"'\n"
  1025.   send    "\nUpdate to: (1 = New 2 = Normal User, 9 = CoSysop, 10 = Sysop ) "
  1026.         input   $level "\r"
  1027.         if      $level == "1" then set $newSysop = "New"
  1028.         if      $level == "1" then goto LevelOK
  1029.         if      $level == "2" then set $newSysop = "Normal"
  1030.         if      $level == "2" then goto LevelOK
  1031.         if      $level == "9" then set $newSysop = "Cosys"
  1032.         if      $level == "9" then goto LevelOK
  1033.  if $level == "10" then if $tmpsysop == "Sysop" then set $newSysop = "Sysop"
  1034.  if $level == "10" then if $tmpsysop == "Sysop" then goto LevelOK
  1035.         goto    UserUpdateOK
  1036. LevelOK:
  1037.         send    "\nULCredits="$inULCredit", should be? (Y/N) "
  1038.         input   $inULCredit "\r"
  1039.  if !$inULCredit == "N" then if !$inULCredit == "Y" then goto LevelOK
  1040. ULOK:
  1041.         send    "\nDLCredits="$inDLCredit", should be? (Y/N) "
  1042.         input   $inDLCredit "\r"
  1043.  if !$inDLCredit == "N" then if !$inDLCredit == "Y" then goto ULOK
  1044.         Set     $newpass = $inpass
  1045.         Set     $newcharset = $incharset
  1046.         Set     $newULCredit = $inULCredit
  1047.         Set     $newDLCredit = $inDLCredit
  1048.         Set     $newStatus = $level
  1049.         Set     $newProto = $inProto
  1050.         Set     $newLast = $inlast
  1051.         gosub   ChangeUser
  1052. LeaveUserUpdate:
  1053.         set     $insysop = $tmpsysop
  1054.         set     $inlast = $tmplast
  1055.         set     $name = $tmpname
  1056.         goto    sysop
  1057.  
  1058. ;********************************************************
  1059. ;Comment to sysop
  1060. ;********************************************************
  1061. Comment:
  1062.         send    "\n\nSubject: "
  1063.         input   $subject "\r"
  1064.         IF $subject == "" then return
  1065.         SET     $to = "Sysop"
  1066.         SET     $mfile = "Comments"
  1067.         SET     $mtype = "Comment to sysop"
  1068.         goto    Writemess
  1069.  
  1070. ;********************************************************
  1071. ;Messages menu
  1072. ;********************************************************
  1073. Messages:
  1074.         ascsend $menudir".menu5"
  1075. Mess1:  send    "\nMessage command (? or ! for menu): "
  1076.         input   $cmd "\r"
  1077.         send    "\n"
  1078.         IF $cmd == "?"  THEN goto Messages
  1079.         IF $cmd == "!"  THEN goto Mess2
  1080.         IF $cmd == ""   THEN return
  1081.         IF $cmd == "Q"  THEN return
  1082.         IF $cmd == "R"  THEN goto Mess3
  1083.         IF $cmd == "W"  THEN goto Mess3
  1084.         GOTO    Mess1
  1085. Mess3:
  1086.         send    "\nArea number (? or ! for menu): "
  1087.         input   $area "\r"
  1088.         IF $area == "?"  THEN goto Mess3a
  1089.         IF $area == "!" THEN goto Mess3b
  1090.         send    "\n"
  1091.         IF exists $msgsdir"messages"$area THEN goto Mess4
  1092.         send    "Illegal Area-number!\n"
  1093.         goto    Mess1
  1094. Mess3a:
  1095.         ascsend $menudir".menu5"
  1096.         goto    Mess3
  1097. Mess3b:
  1098.         ascsend $menudir"menu5"
  1099.         goto    Mess3
  1100. Mess2:  ascsend $menudir"menu5"
  1101.         goto    Mess1
  1102. Mess4:  IF $cmd =="R"   THEN goto Read
  1103.         gosub   Enter
  1104.         goto    Mess1
  1105.  
  1106. ;********************************************************
  1107. ;Enter message
  1108. ;********************************************************
  1109. Enter:
  1110.         send    "\nTo (Enter=ALL): "
  1111.         input   $to "\r"
  1112.         IF $to == "" then SET $to = "ALL"
  1113.         send    "\nSubject: "
  1114.         input   $subject "\r"
  1115.         IF $subject == "" then return
  1116.         SET     $mfile = "messages"$area
  1117.         SET     $mtype = "Area"$area
  1118.         goto    Writemess
  1119.  
  1120.  
  1121.  
  1122. ;********************************************************
  1123. ;Read public messages
  1124. ;********************************************************
  1125. Read:
  1126.         ascsend $msgsdir"messages"$area
  1127.         write   $dir"log" $date"  Read message in area "$area"\n"
  1128.         goto    Mess1
  1129.  
  1130.  
  1131. ;********************************************************
  1132. ;Read private messages
  1133. ;********************************************************
  1134. Priv:   IF !EXISTS $msgsdir"comments" then goto sysok
  1135.         ascsend $msgsdir"comments"
  1136.         write   $dir"log" $date"  Read private messages.\n"
  1137.         goto    sysok
  1138.  
  1139. ;********************************************************
  1140. ;Handle NO CARRIER
  1141. ;********************************************************
  1142. NoCarrier:
  1143.         write   $dir"log" $date"  CARRIER LOST\n"
  1144.         gosub   logout
  1145.         goto    main
  1146.  
  1147.  
  1148. ;********************************************************
  1149. ;View ZOO file
  1150. ;********************************************************
  1151. ViewZOO:
  1152.         send    "\nGive the name of the  "$arch" file: "
  1153.         input   $file "\r"
  1154.         send    "\n"
  1155.         IF $file == "" then return
  1156.         IF exists $dldir$file then goto ViewOK
  1157.         IF exists $dldir$file$arch then goto ViewOK
  1158.         send    "The file does not exist!\n"
  1159.         return
  1160. ViewOK: write   $dir"log" $date" "$arch" view of "$file"\n"
  1161.         CLI     $alist$dldir$file
  1162.         return
  1163.  
  1164.  
  1165. ;********************************************************
  1166. ;Extract ZOO file
  1167. ;********************************************************
  1168. ExtractZOO:
  1169.         IF $DLCredit == "Y" then goto DownlOK1
  1170.         send    "\nNo files up, no files down....\n"
  1171.         return
  1172. ExtraZ1:
  1173.         send    "\nGive the name of the  "$arch" file: "
  1174.         input   $file "\r"
  1175.         send    "\n"
  1176.         IF $file == "" then return
  1177.         IF exists $dldir$file then goto ExtOK
  1178.         IF exists $dldir$file$arch then goto ExtOK
  1179.         send    "The file does not exist!\n"
  1180.         return
  1181. ExtOK:  send    "\nGive the name of the file(s) to extract [Enter=all]: "
  1182.         input   $files "\r"
  1183.         write   $dir"log" $date"  Extracted "$file" "$files"\n"
  1184.         send    "\n"
  1185.         CLI     "delete >nil: "$tmp
  1186.         write   $tmp "CD "$hold"\n"
  1187.         write   $tmp $aextract$dldir$file" "$files"\n"
  1188.         CLI     "execute "$tmp
  1189.         return
  1190.  
  1191.  
  1192. ;********************************************************
  1193. ;Add file to HOLD
  1194. ;********************************************************
  1195. AddFile:
  1196.         IF $DLCredit == "Y" then goto DownlOK1
  1197.         send    "\nNo files up, no files down....\n"
  1198.         return
  1199. AddF1:
  1200.         send    "\nFilename: "
  1201.         input   $file "\r"
  1202.         send    "\n"
  1203.         IF $file == "" then return
  1204.         IF exists $dldir$file then goto AddOK
  1205.         send    "The file '"$file"' does not exist!\n"
  1206.         return
  1207. AddOK:  CLI     "COPY "$dldir$file" "$hold
  1208.         write   $dir"log" $date"  Added "$file"\n"
  1209.         return
  1210.  
  1211.  
  1212. ;********************************************************
  1213. ;Delete file(s) from HOLD
  1214. ;********************************************************
  1215. Remove: send    "\nFilename: "
  1216.         input   $file "\r"
  1217.         send    "\n"
  1218.         IF $file == "" then return
  1219.         write   $dir"log" $date"  Deleted "$file"\n"
  1220.         CLI     "delete \""$hold$file"\""
  1221.         return
  1222.  
  1223.  
  1224. ;********************************************************
  1225. ;List files in HOLD directory
  1226. ;********************************************************
  1227. Show:
  1228.         send    "\n"
  1229.         CLI     $list" "$hold
  1230.         return
  1231.  
  1232.  
  1233. ;********************************************************
  1234. ;Download files in HOLD directory
  1235. ;********************************************************
  1236. GetHold:
  1237.         send    "Wait while I pack the files...\n"
  1238.         CLI     "delete >nil: "$holdzoo
  1239.         CLI     $apack$holdzoo" "$hold"*"
  1240. GetPr:
  1241.         send    "Choose protocol (return for "$proto"):"
  1242.         input   $nproto "\r"
  1243.         send    "\n"
  1244.         IF $nproto == "" THEN goto XGet
  1245.         set     $trans = $nproto
  1246.         gosub   CheckProto
  1247.         set     $proto = $trans
  1248.         gosub   SetProto
  1249. XGet:
  1250.         send    "Waiting...\n"
  1251.         upload  $holdzoo
  1252.         write   $dir"log" $date"  Downloaded HOLD"$arch" (Xmodem)\n"
  1253.         CLI     "delete >nil: "$holdzoo
  1254.         return
  1255.  
  1256. ;********************************************************
  1257. ;Letter menu, private mail
  1258. :********************************************************
  1259. LetterMenu:
  1260.         send    "\nLetter command (? or ! for menu): "
  1261.         input   $cmd "\r"
  1262.         send    "\n"
  1263.         IF $cmd == "?" THEN ascsend $menudir".menu4"
  1264.         IF $cmd == "!" THEN ascsend $menudir"menu4"
  1265.         IF $cmd == ""  THEN return
  1266.         IF $cmd == "Q" THEN return
  1267.         IF $cmd == "R" THEN gosub ReadLetter
  1268.         IF $cmd == "W" THEN gosub WriteLetter
  1269.         IF $cmd == "E" THEN gosub DeleteLetter
  1270.         IF $cmd == "G" THEN gosub GrabMail
  1271.         goto    LetterMenu
  1272.  
  1273. ;********************************************************
  1274. ;Enter message
  1275. ;********************************************************
  1276. WriteLetter:
  1277.         send    "\nTo: (enter to abort) "
  1278.         input   $to "\r"
  1279.         IF      $to == "" then return
  1280.         gosub CheckName
  1281.         if      $NameOK == "T" THEN goto WLCont
  1282.         send    "There is no user with the name "$to
  1283.         goto    WriteLetter
  1284. WLCont: send    "\nSubject: (enter to abort) "
  1285.         input   $subject "\r"
  1286.         IF      $subject == "" then return
  1287.         SET     $mtype = "Private"
  1288.         SET     $mfile = $to
  1289.         goto    writemess
  1290.  
  1291.  
  1292.  
  1293. ;********************************************************
  1294. ;Read private messages
  1295. ;********************************************************
  1296. ReadLetter:
  1297.         IF !EXISTS $msgsdir$name then goto NoLetter
  1298.         ascsend $msgsdir$name
  1299.         write   $dir"log" $date"  Read private letters \n"
  1300.         return
  1301. NoLetter:
  1302.         send "No private mail to "$name"\n"
  1303.         return
  1304.  
  1305. ;********************************************************
  1306. ;Delete private messages
  1307. ;********************************************************
  1308. DeleteLetter:
  1309.         send    "\nErase all private mail? (Enter=N) "
  1310.         input   $cmd "\r"
  1311.         send    "\n"
  1312.         IF !$cmd == "Y" then return
  1313.         CLI "delete >nil: \""$msgsdir$name"\""
  1314.         write   $dir"log" $date"  Private messages deleted\n"
  1315.         return
  1316.  
  1317.  
  1318. ;********************************************************
  1319. ;Grab all mail
  1320. ;********************************************************
  1321. GrabMail:
  1322.         CLI "copy >nil: \""$msgsdir$name"\" to \""$hold"\""
  1323.         send    "\n\nAdd messageareas (enter=Y) ?"
  1324.         input   $cmd "\r"
  1325.         send    "\n\n"
  1326.  if !$cmd == "N" then CLI "copy >nil: \""$msgsdir"messages#?\" to \""$hold"\""
  1327.         send    "\n\nAdd bulletins (enter=Y) ?"
  1328.         input   $cmd "\r"
  1329.         send    "\n\n"
  1330.  if !$cmd == "N" then CLI "copy >nil: \""$bulldir"bull#?\" to \""$hold"\""
  1331.         write   $dir"log" $date"  Fetched mail\n"
  1332.         goto    gethold
  1333.  
  1334. ;********************************************************
  1335. ;Enter message
  1336. ; $to           = to who
  1337. ; $mfile        = to wich file
  1338. ; $mtype        = type of message
  1339. ;********************************************************
  1340. WriteMess:
  1341.         CLI     $delete " >NIL: RAM:__NHSX__TMP__"
  1342.         cli     $copy " >nil: \""$msgsdir$mfile"\" to RAM:__NHSX__TMP__"
  1343.         SET     $header = "\n\nFrom: "$name"\n"
  1344.         SET     $header = $header"To: "$to"\nSubject: "$subject"\n"
  1345.         SET     $header = $header"Date: "$date"\n"
  1346.         SET     $header = $header"-------------------------------\n"
  1347.         write   "RAM:__NHSX__TMP__" $header
  1348.         send    $header
  1349.         send    "[Write in your message below; "
  1350.         send    "end with Ctrl-Z on a blank line]\n\n"
  1351.         when    "^Z" goto endWL
  1352. WLent:  input   $line "\r"
  1353.         send    "\n"
  1354.         write   "RAM:__NHSX__TMP__" $line"\n"
  1355.         goto    WLent
  1356. EndWL:  dlwhen
  1357.         cli     $copy " >nil: RAM:__NHSX__TMP__ to \""$msgsdir$mfile"\""
  1358.         send    "\nMessage saved!^G\n"
  1359.         write   $dir"log" $date"  Entered "$mtype" message\n"
  1360.         return
  1361.  
  1362.  
  1363.